#include "include/counter.h"


void startCounter0(Counter *C)
{
  bitSet(&TIMSK, TOIE0);
  writeByte(&TCNT0, C->SetPoint);
  writeByte(__TCCR0__, C->CM);
  addHandler(HWND_COUNTER0, C->fHandler);
}


void startContador0()
{
	bitSet(&TIMSK, TOIE0);
	writeByte(&TCNT0, 254);
	bitSet(&TCCR0, CS02);
	bitSet(&TCCR0, CS01);
	bitReset(&TCCR0, CS00);
}

void start16BitCounter()
{
	bitSet(&TIMSK, TOIE1);
	writeByte(&TCNT1H, 255);
	writeByte(&TCNT1L, 0);
	writeByte(&TCCR1B, 5);
	bitReset(&TCCR1B, CS10);
}

void on8BitCounter_Overflow(void (*pHandler))
{
//	if (!pTC0_Handler)
		//pTC0_Handler = pHandler;
}

void on16BitCounter_Overflow(void (*pHandler))
{
	//if (!pTC1_Handler)
		//pTC1_Handler = pHandler;
}
